﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using Plugin.Base;
namespace Manager
{
    class PluginManager
    {
        string[] DllList;
        Assembly Asm = null;
        Type ObjType = null;


        public void FindPlugin(string path)
        {

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);

            }
            else
            {

                DllList = Directory.GetFiles(path, "*.dll");

                for (int i = 0; i < DllList.Length; i++)
                {

                    Asm = Assembly.LoadFrom(DllList[i]);

                }
             
            }
            

        }

        public void InstancePlugins()
        {

            foreach (Type pType in Asm.GetTypes())
            {
                if (pType.IsPublic)
                {
                    if (pType.IsAbstract)
                    {
                        Type Abs;
                        
                         Abs =  (Plugin.Base.IPluginClass)Activator.CreateInstance(pType);
                       


                    }

                }
                
            }

          

        }
      

    }
}

